<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    var arr=[],
        push=arr.push;
    Itcast.fn.insertBefore=function(selector){
        var iobj=this.constructor(selector);
        var tmp=[],tmpNode;
        for(var i=0;i<this.lenght;i++){
            for(var j=0;j<iobj.length;j++){
                tmpNode=j==iobj.length-1?this[i]:this[i].cloneNode(true)
                tmp.push(tmpNode);
                iobj[j].parentNode.insertBefore(tmp,iobj[j])
            }
        }
        var tmpIobj=this.constructor();
        tmpIobj.prevObject=this;
        push.apply(tmpIobj,tmp);
        return tmpIobj;
    }
    Itcast.fn.before=function(selector){
        this.constructor(selector).insertBefore(this)
        return this
    };

</script>
</body>
</html>